#include <types.h>

void *memcpy(void *dst, void *src, uint_32 count)
{
  uint_8 *pd = (uint_8 *) dst;
  uint_8 *ps = (uint_8 *) src;

  if(count < 4)
  {
    while(count)
      *pd++ = *ps++;
  }
  else 
  {
    uint_32 dwcount = count/4;
    uint_32 btcount = count - dwcount;

    while(dwcount--)
    {
      *(uint_32 *)pd = *(uint_32 *)ps;
      pd += 4;
      ps += 4;
    }

    while(btcount--)
      *pd++ = *ps++;
  }

  return (void *) dst;
}

    
    
uint_32 memset(void *dst, uint_8 val, uint_32 count)
{
  if(!dst)
    return 0;
  while(count--)
    *(uint_8 *)dst++ = val;

  return 1;
}
